#include <gtest/gtest.h>
#include <iostream>
#include <unordered_map>
std::unordered_map<std::string, std::string> dict;
class Myenvironment : public testing::Environment
{
    virtual void SetUp() override
    {
        std::cout << "测试前:提前准备数据!!\n";
        dict.insert(std::make_pair("hello", "你好"));
        dict.insert(std::make_pair("word", "单词"));
        dict.insert(std::make_pair("apple", "苹果"));
    }

    virtual void TearDown() override
    {
        std::cout << "测试结束后:清理数据!!\n";
        dict.clear();
    }
};

TEST(Myenvironment, find_test)
{
    auto it = dict.find("hello");
    ASSERT_NE(it, dict.end());
}

TEST(Myenvironment, size_test)
{
    ASSERT_GT(dict.size(), 0);
}

int main(int argc, char *argv[])
{
    testing::AddGlobalTestEnvironment(new Myenvironment);

    testing::InitGoogleTest(&argc, argv);

    return RUN_ALL_TESTS();
}
